package tt.dz.biz.service.account;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import tt.dz.biz.dao.account.AssetsLbltsAccountRuleDAO;
import tt.dz.common.LogUtil;
import tt.dz.vo.AssetsLbltsAccountRuleVO;

@Service("assetsLbltsAccountRuleService")
public class AssetsLbltsAccountRuleService
{
  @Resource(name="assetsLbltsAccountRuleDAO")
  AssetsLbltsAccountRuleDAO assetsLbltsAccountRuleDAO;
  
  public List<AssetsLbltsAccountRuleVO> listAllAssetsLbltsAccountRule()
  {
    List<AssetsLbltsAccountRuleVO> accountingRuleList = null;
    try
    {
      accountingRuleList = this.assetsLbltsAccountRuleDAO.listAllAssetsLbltsAccountRule();
    }
    catch (Exception e)
    {
      LogUtil.error("查询所有资产/负债账户记账规则异常", e);
      accountingRuleList = new ArrayList();
    }
    return accountingRuleList;
  }
  
  public boolean insertAssetsLbltsAccountRule(AssetsLbltsAccountRuleVO assetsLbltsAccountRuleVO)
  {
    boolean excuteFlag = false;
    try
    {
      int i = this.assetsLbltsAccountRuleDAO.insertAssetsLbltsAccountRule(assetsLbltsAccountRuleVO);
      excuteFlag = i > 0;
    }
    catch (Exception e)
    {
      LogUtil.error("插入资产/负债账户记账规则异常", e);
    }
    return excuteFlag;
  }
  
  public boolean updateAssetsLbltsAccountRule(AssetsLbltsAccountRuleVO assetsLbltsAccountRuleVO)
  {
    boolean excuteFlag = false;
    try
    {
      int i = this.assetsLbltsAccountRuleDAO.updateAssetsLbltsAccountRule(assetsLbltsAccountRuleVO);
      excuteFlag = i > 0;
    }
    catch (Exception e)
    {
      LogUtil.error("更新资产/负债账户记账规则异常", e);
    }
    return excuteFlag;
  }
}
